Skip to content

Feature/resource guide search feedback#364

Open
ScottProgrammer88 wants to merge 23 commits intomainfrom
feature/resource-guide-search-feedback
Open

Feature/resource guide search feedback#364
ScottProgrammer88 wants to merge 23 commits intomainfrom
feature/resource-guide-search-feedback

Conversation

@ScottProgrammer88
Copy link
Copy Markdown
Contributor

This pull request introduces a new feedback system for users and administrators, adds new feedback-related database tables and methods, and includes some minor improvements to existing code. The most important changes are summarized below:

Feedback System Implementation:

  • Added new feedback-related methods in ResourcesController to allow users to submit feedback and administrators to view, edit, mark as reviewed, and delete feedback. (PC2/Controllers/ResourcesController.cs)
  • Introduced a new Feedback table in the database with columns for Id, IsResourceFound, Comments, SubmittedAt, and IsReviewed. (PC2/Data/Migrations/20250130011311_AddFeedbackTable.cs, PC2/Data/Migrations/20250216203424_RenameFoundResourceToIsResourceFound.cs, PC2/Data/Migrations/20250217035356_AddIsReviewedToFeedback.cs) [1] [2] [3]
  • Updated the ApplicationDbContext to include the new Feedback DbSet. (PC2/Data/ApplicationDbContext.cs)

ViewData and ViewBag Enhancements:

  • Modified the ResourceGuide methods to conditionally show the feedback form based on user searches. (PC2/Controllers/ResourcesController.cs) [1] [2] [3]

Database Configuration Updates:

  • Updated the ApplicationDbContextModelSnapshot to reflect the new Feedback table and adjusted identity column configurations. (PC2/Data/Migrations/ApplicationDbContextModelSnapshot.cs) [1] [2] [3] [4] [5] [6] [7] [8]

These changes aim to enhance user interaction by collecting feedback and providing administrators with tools to manage that feedback effectively.

A new Feedback class has been added to the PC2.Models namespace.
The class includes properties: Id, FoundResource, Comments, and
SubmittedAt. The Comments property uses the MaxLength attribute
from System.ComponentModel.DataAnnotations to limit its length
to 500 characters.
The ApplicationDbContext class in the PC2.Data namespace now includes a new DbSet<Feedback> property. This addition enables CRUD operations for a new Feedback table in the database, allowing the application to store and manage user feedback.
Introduce migration 20250130011311_AddFeedbackTable to add a new Feedback table with Id, FoundResource, Comments, and SubmittedAt columns. Update the Discriminator column in the People table to have a max length of 21 characters. Reflect these changes in ApplicationDbContextModelSnapshot and update ProductVersion to 8.0.11. Remove explicit seed values in UseIdentityColumns method calls. Update BuildTargetModel in Designer file and implement Up and Down methods for the migration.
Introduced a new `FeedbackViewModel` class within the `PC2.Models` namespace. This class includes properties for handling feedback data: `Id` (integer identifier), `FoundResource` (string representation of a boolean value), `Comments` (user comments), and `FormattedSubmittedAt` (formatted date string for readability).
Added a new navigation menu item for "View Feedback" in the `_Layout.cshtml` file. This link directs users to the `ViewFeedback` action in the `Resources` controller and is positioned between the "Housing Program Data" link and the "Calendar" dropdown menu.
Added a new model binding to use a list of FeedbackViewModel objects.
Introduced a "User Feedback" section with an <h2> header.
Created an HTML table with headers for "Found Resource", "Comments", and "Submitted At".
Implemented a foreach loop to populate the table with feedback data.
Added necessary namespaces to ResourcesController.cs for authorization, database operations, and metrics. Introduced a feature to show the feedback form post-search. Added SubmitFeedback method to handle feedback submissions, including saving to the database and displaying success messages. Added ViewFeedback method for admins to view submitted feedback, with data retrieval and projection into FeedbackViewModel.
Enhanced readability and visual appeal of the feedback table by:
- Adding padding to header and data cells
- Applying background color to the header row
- Adding bottom border to data cells
- Structuring the table with <thead> and <tbody> sections
Added summary comments to the Feedback class and its properties:
- Described the purpose of the Feedback class.
- Explained the role of the Id property as a unique identifier.
- Clarified the FoundResource property indicating resource discovery.
- Indicated that the Comments property holds optional user comments.
- Described the SubmittedAt property as the feedback submission timestamp.
…ling

Introduced a success message alert that displays when TempData["SuccessMessage"] is set, styled with Bootstrap and includes a close button.
Updated the feedback form to replace the checkbox with "Yes" and "No" buttons for improved user interaction.
Ensured the comments field is optional while enforcing a 500-character limit on the client side.
Styled the character limit note to appear in red for better visibility.
Updated ResourceGuide and another method in ResourcesController to
control feedback form visibility based on search actions. Added
error logging in SubmitFeedback to aid in debugging model state
issues.
Introduce XML documentation comments to the FeedbackViewModel class
in FeedbackViewModel.cs. These comments describe the class and its
properties, including Id, FoundResource, Comments, and
FormattedSubmittedAt, enhancing code readability and maintainability.
Renamed the FoundResource property to IsResourceFound in various files to better reflect its purpose:
- Updated `ResourcesController.cs` to use `IsResourceFound` in `FeedbackViewModel` projection.
- Renamed `FoundResource` to `IsResourceFound` in `Feedback.cs` model.
- Modified `FeedbackViewModel.cs`:
  - Renamed `FoundResource` to `IsResourceFound`.
  - Marked `IsResourceFound` and `FormattedSubmittedAt` as required.
  - Made `Comments` property nullable.
- Updated `ResourceGuide.cshtml` and `ViewFeedback.cshtml` views to use `IsResourceFound`.
This migration renames the `FoundResource` column to `IsResourceFound` in the `Feedback` table to better reflect its boolean nature. The `20250216203424_RenameFoundResourceToIsResourceFound.Designer.cs` and `ApplicationDbContextModelSnapshot.cs` files are updated to reflect this change. The migration file includes `Up` and `Down` methods for applying and reverting the column name change.
The Feedback property in the ApplicationDbContext class has been
modified to be virtual. This change allows for greater flexibility
in testing and extending the ApplicationDbContext class by enabling
the Feedback property to be overridden in derived classes. Also, removed old comment.
Introduced a new boolean property `IsReviewed` in the `Feedback`
class within the `PC2.Models` namespace to indicate whether the
feedback has been reviewed by an administrator. The property is
initialized to `false` by default. Similarly, added the same
`IsReviewed` property to the `FeedbackViewModel` class to track
the review status in the view model as well. These changes
enhance the feedback management functionality.
Introduce a new boolean column `IsReviewed` to the `Feedback` table with a default value of `false`. Update the migration files and model snapshot to reflect this change, ensuring the Entity Framework model is in sync with the database schema.
- Change page title to dynamic value using `ViewData["Title"]`
- Update table to use Bootstrap `table` class for styling
- Simplify table header and improve column names
- Add "Actions" column with edit/delete links
- Add "Reviewed" column with auto-submitting checkbox form
- Add "Back to Home" link for easier navigation
Introduce a new view for editing feedback in the `EditFeedback.cshtml` file.
Set a model of type `PC2.Models.FeedbackViewModel` for the view.
Set the page title to "Edit Feedback".
Create a form to allow users to edit feedback, including:
- Hidden input for `Id`
- Read-only input for `IsResourceFound`
- Textarea for `Comments` with validation
- Read-only input for `FormattedSubmittedAt`
- Checkbox for `IsReviewed`
Include "Save" and "Cancel" buttons in the form.
Add a link to navigate back to the feedback list.
Introduce DeleteFeedback.cshtml view for confirming feedback deletion.
- Strongly typed to PC2.Models.Feedback model.
- Set page title to "Delete Feedback".
- Display feedback comments and submission date.
- Include form with hidden input for feedback ID and submit button.
- Add link to navigate back to feedback list.
Replaced ViewBag.ShowFeedbackForm with ViewData["ShowFeedbackForm"].
Added XML documentation comments to several methods.
Introduced EditFeedback method for admin feedback editing.
Added DeleteFeedback method for admin feedback deletion.
Introduced MarkAsReviewed method to mark feedback as reviewed.
Enhanced SubmitFeedback method for better feedback handling.
Updated ViewFeedback method to show IsReviewed status.
Comment thread PC2/Controllers/ResourcesController.cs Outdated
Comment thread PC2/Controllers/ResourcesController.cs Outdated
Comment thread PC2/Controllers/ResourcesController.cs Outdated
Comment thread PC2/Views/Shared/_Layout.cshtml Outdated
Comment thread PC2/Controllers/ResourcesController.cs Outdated
Comment thread PC2/Controllers/ResourcesController.cs Outdated
@JoeProgrammer88
Copy link
Copy Markdown
Member

@ScottProgrammer88 Feedback from client: They would like the resource guide feedback to email them a notification that somebody has left feedback. They like the idea of feedback being sent in an email, so they don't have to log into the website. They are happy with starting with a Weekly Feedback email. This could be a challenging feature to implement. You can focus on the feedback form itself and we can make a separate issue for emailing a weekly summary if needed

Removed unused `System.Diagnostics.Metrics` namespace import.
Removed logging of model state errors in `SubmitFeedback`.
Changed role authorization to use `IdentityHelper.Admin`.
Replaced var declarations with explicit type declarations.
Updated `ViewFeedback` to use `FeedbackViewModel` list.
Removed commented-out code in `_Layout.cshtml`.
@ScottProgrammer88 ScottProgrammer88 marked this pull request as ready for review February 25, 2025 22:15
@JoeProgrammer88 JoeProgrammer88 linked an issue May 7, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Survey Users on Resource Guide results

2 participants